package vo

const (
	ActionEnc                = "enc"
	ActionDec                = "dec"
	ActionDecBatch           = "dec_batch"
	ActionCmdRun             = "cmd_run"
	ActionCmdStart           = "cmd_start"
	ActionCmdOpen            = "cmd_open"
	ActionPathRecognize      = "path_recognize"
	ActionRunFileOrDir       = "file_dir_run"
	ActionSelectFileOrDir    = "file_dir_select"
	ActionOpenAs             = "file_url_openas"
	ActionOpenIn             = "file_openin"
	ActionOpenBy             = "file_url_txt_openby"
	ActionLoadIcon           = "load_icon"
	ActionGetUrlFromClip     = "get_url_from_clip"
	ActionGetImgUrlFromClip  = "get_img_url_from_clip"
	ActionSaveClipFileLocal  = "clip_file_to_local"
	ActionSaveClipImgLocal   = "clip_img_to_local"
	ActionSaveClipFileRemote = "clip_file_to_remote"
	ActionSaveClipImgRemote  = "clip_img_to_remote"
	ActionGetClipPossibleOp  = "clip_possible_op"
	ActionLoadCtxMenu        = "load_ctx_menu"
	ActionZipDir             = "zip_dir"
	ActionFulltextSearchTags = "fulltext_search_tags"
	ActionFulltextSearch     = "fulltext_search"
	ActionScrshotCombine     = "combine_scrshot"
)

type BaseActionReq struct {
	Action string
}

type BaseActionResp struct {
	State int
	Msg   string
}

type TxtReq struct {
	BaseActionReq
	Txt string
}

type TxtResp struct {
	BaseActionResp
	Txt string
}

type TxtsReq struct {
	BaseActionReq
	Txts []string
}

type TxtsResp struct {
	BaseActionResp
	Txts []string
}

type CmdRunReq struct {
	BaseActionReq
	Cmd         string
	Pause       bool
	ExitTimeout int
}

type TitleUrlResp struct {
	BaseActionResp
	Title string
	Url   string
}

type CtxMenuItem struct {
	Title string
	Url   string
}

type CtxMenuResp struct {
	BaseActionResp
	Items []CtxMenuItem
}

type PathReq struct {
	BaseActionReq
	Path         string
	CtxDir       string
	ForceCmdMode bool
	CodePage     int
}

type OpenInReq struct {
	PathReq
	Dir string
}

type OpenByReq struct {
	PathReq
	Opener string
	Option string
	UseDir bool
}

type ZipDirReq struct {
	BaseActionReq
	SrcDir          string
	DestZipFullpath string
	ContainsRootDir bool
}

// 对应 CombineShotReq.ResultType
const (
	CombineShotResultMem int = 0
	CombineShotResultImg int = 1
	CombineShotResultPdf int = 2
	CombineShotResultDoc int = 3
)

type CombineShotFragItem struct {
	X1, Y1, X2, Y2 int
	FragPath       string
}

type Size struct {
	Width  int
	Height int
}

// CombineShotReq 截图合并的请求信息
// ForceValidSize 是否强制把图片裁剪为 ValidSize 指定的大小，裁剪时会从中心开始，把四周多出部分去掉
// ResultMultiPage 当导出节点内容为为单页，即false，导出引用部分内容时为多页，即true，ResultMultiPage只在导出pdf和word文档时有效
type CombineShotReq struct {
	BaseActionReq
	SumSize         Size
	Items           []CombineShotFragItem
	ResultType      int
	ResultPath      string
	ResultMultiPage bool
	ForceValidSize  bool
	ValidSize       Size
}

type RecognizedPathResp struct {
	BaseActionResp
	Path   string
	IsFile bool
	IsDir  bool
}

// ClipPossibleOpResp 可能进行的剪切板操作
type ClipPossibleOpResp struct {
	BaseActionResp
	GetUrl       bool
	GetImgUrl    bool
	ImgToLocal   bool
	ImgToRemote  bool
	FileToLocal  bool
	FileToRemote bool
}

// LoadIconResp 加载图标的返回结果
// Cascade - 是否两图标叠加，为true时Url为主体大图标，Url2为小图标，为false时Url为图标地址，Url2为空
type LoadIconResp struct {
	BaseActionResp
	Cascade bool
	Url     string
	Url2    string
}
